import axios from '@/utils/myaxios.js';

export const getPostList = params => {
  return axios({
    url: '/post',
    params
  });
};

export const getArticleById = id => {
  return axios({
    url: `/post/${id}`
  });
};

export const post_like = id => {
  return axios({
    url: `/post_like/${id}`
  });
};

export const starArticle = id => {
  return axios({
    url: `/post_star/${id}`
  });
};

export const post_comment = id => {
  return axios({
    url: `/post_comment/${id}`
  });
};

export const sendcomment = (id, data) => {
  return axios({
    method: 'post',
    url: `/post_comment/${id}`,
    data
  });
};

export const category = id => {
  return axios({
    url: `/category`
  });
};

export const post_search = keyword => {
  return axios({
    url: `/post_search`,
    params: { keyword }
  });
};